﻿package frEngine.shader.filters.vertexFilters
{
    import __AS3__.vec.*;
    import frEngine.shader.*;
    import frEngine.shader.filters.*;
    import frEngine.shader.filters.vertexFilters.def.*;

    public class Scale9GridFilter extends VertexFilter
    {
        public var PositionData:Vector.<Number>;

        public function Scale9GridFilter(param1:Vector.<Number> = null)
        {
            super(FilterType.Scale9GridFilter);
            this.PositionData = param1;
            return;
        }// end function

        override public function setRegisterParams(param1:Program3dRegisterInstance) : void
        {
            param1.getParamByName("{vertextPoints}", true).value = this.PositionData;
            return;
        }// end function

        override public function get programeId() : String
        {
            return "Scale9Grid0";
        }// end function

        override public function clone() : FilterBase
        {
            return this;
        }// end function

        override public function createVertexCode(param1:Program3dRegisterInstance, param2:int) : String
        {
            var _loc_3:Array = [];
            _loc_3.push(new ToBuilderInfo("vc0-15", "{vertextPoints}", false, 16, this.PositionData));
            _loc_3.push(new ToBuilderInfo("va0", FilterName.POSITION, false, 1));
            _loc_3.push(new ToBuilderInfo("vf0", "{V_UvOriginalPos}", false, 1));
            var _loc_4:String = "";
            _loc_4 = _loc_4 + "mov vt0 vc[va0.x] \n";
            _loc_4 = _loc_4 + "mov {output} vt0 \n";
            _loc_4 = _loc_4 + "mov {output}.z {vcConst1}.x  \n";
            _loc_4 = _loc_4 + "mov {output}.w {vcConst1}.z \n";
            _loc_4 = _loc_4 + "mov  vf0.xyzw vt0.zwww\t\t\n";
            param1.OpType = ECalculateOpType.None;
            _loc_4 = param1.toBuild(_loc_4, _loc_3);
            return _loc_4;
        }// end function

    }
}
